package cn.wolfcode.mp.web.controller;


import cn.wolfcode.mp.qo.JsonResult;
import cn.wolfcode.mp.service.IEmployeeService;
import cn.wolfcode.mp.util.RequiredPermission;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("employees")
public class EmployeeController {

    @Autowired
    private IEmployeeService employeeService;

    @GetMapping("/list")
    @RequiredPermission(name = "员工页面",expression = "employee:list")
    public JsonResult list(){
        return new JsonResult(employeeService.list());
    }

    @DeleteMapping("/delete")
    @RequiredPermission(name = "员工删除",expression = "employee:delete")
    public JsonResult delete(Long id){
        employeeService.removeById(id);
        return new JsonResult();
    }


}
